package com.ziyia.a282;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.widget.CalendarView;
import android.widget.Toast;

public class MyCalenderView extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_calendarv_iew);
        CalendarView calendarView = findViewById(R.id.calenderview);

        calendarView.setOnDateChangeListener(new CalendarView.OnDateChangeListener() {
            @Override
            public void onSelectedDayChange(@NonNull CalendarView view, int year, int month, int dayOfMonth) {
                Toast.makeText(MyCalenderView.this, String.format("你的生日是：%d 年 %d 月 %d 日",year, month, dayOfMonth), Toast.LENGTH_SHORT).show();
            }
        });


    }
}